package com.example240705;

import jakarta.persistence.Table;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Table(name = "student_info")
public interface StudentReposity extends JpaRepository<StudentInfo, Long> {
    @Query(value = "SELECT * FROM student_info WHERE gender=:gender LIMIT 5 ;", nativeQuery = true)
    List<StudentInfo> findAllByGender(@Param("gender") Character gender);

    @Query(value = "SELECT * FROM student_info WHERE id_seq=:id_seq LIMIT 1 ;", nativeQuery = true)
    StudentInfo findByIdSeq(@Param("id_seq") String id_seq);

    @Query(value = "SELECT id FROM student_info WHERE id_seq=:id_seq LIMIT 1 ;", nativeQuery = true)
    Long findIdByIdSeq(@Param("id_seq") String id_seq);

}